﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:m="clr-namespace:Signum.Windows"
    xmlns:mc="clr-namespace:Signum.Windows.ColorUtils">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="PickerBase.generic.xaml" />
    </ResourceDictionary.MergedDictionaries>
    <Style TargetType="{x:Type m:ColorPicker}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type m:ColorPicker}">
                    <m:PickerBase x:Name="PART_PickerBase"  
					Background="{TemplateBinding Background}" 
					BorderBrush="{TemplateBinding BorderBrush}">
                        <m:PickerBase.ButtonContent>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>

                                <Ellipse Grid.Column="0" Width="16" Height="16">
                                    <Ellipse.Fill>
                                        <SolidColorBrush Color="{Binding SelectedColor, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"/>
                                    </Ellipse.Fill>
                                </Ellipse>

                                <TextBox x:Name="PART_EditableTextBox"  
							Grid.Column="1"
							Style="{StaticResource ComboBoxEditableTextBox}" 
							Text="{Binding SelectedColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true, UpdateSourceTrigger=PropertyChanged}"/>
                            </Grid>
                        </m:PickerBase.ButtonContent>
                        <m:PickerBase.PopupContent>
                            <Border BorderBrush="Black" BorderThickness="1">
                                <mc:ColorSelector  x:Name="PART_ColorSelector"/>
                            </Border>
                        </m:PickerBase.PopupContent>
                    </m:PickerBase>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>